lib/sign-ed25519: cleanup unneeded code
authorDenis Pynkin <denis.pynkin@collabora.com>
Sun, 6 Oct 2019 20:40:04 +0000 (23:40 +0300)
committerDenis Pynkin <denis.pynkin@collabora.com>
Wed, 25 Mar 2020 12:23:54 +0000 (15:23 +0300)
Removed unused code.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
apidoc/ostree-sections.txt
src/libostree/libostree-devel.sym
src/libostree/ostree-sign-ed25519.c
src/libostree/ostree-sign-ed25519.h

index 806bd1a77664e8bf09567e8a566d6aeb43293b49..1ea6e5480bc76bb40560e3fa6d08949bada82d76 100644 (file)
@@ -723,7 +723,6 @@ ostree_sign_add_pk
 ostree_sign_load_pk
 ostree_sign_set_pk
 ostree_sign_set_sk
-ostree_sign_ed25519_keypair_generate
 <SUBSECTION Standard>
 ostree_sign_get_type
 ostree_sign_dummy_get_type
index 8be5a3bf8f78f8fd5c9c65c3280eed8a746f08b8..93f904b12b5e6d52afe01011b3307412335e5379 100644 (file)
@@ -37,7 +37,6 @@ global:
   ostree_sign_set_sk;
   ostree_sign_dummy_get_type;
   ostree_sign_ed25519_get_type;
-  ostree_sign_ed25519_keypair_generate;
 } LIBOSTREE_2020.1;
 
 /* Stub section for the stable release *after* this development one; don't
index c6c163025b9ed8e3a7a23307b02cde13d2796c1f..1fb6ae057bedd9ba45ece0c0c08aa317640d60fd 100644 (file)
 #define OSTREE_SIGN_METADATA_ED25519_KEY "ostree.sign.ed25519"
 #define OSTREE_SIGN_METADATA_ED25519_TYPE "aay"
 
-#if 0
-#define SIGNIFY_COMMENT_HEADER "untrusted comment:"
-#define SIGNIFY_ID_LENGTH 8
-#define SIGNIFY_MAGIC_ED25519 "Ed"
-#endif
-
 struct _OstreeSignEd25519
 {
   GObject parent;
@@ -259,45 +253,6 @@ out:
   return ret;
 }
 
-gboolean
-ostree_sign_ed25519_keypair_generate (OstreeSign *self,
-                                      GVariant **out_secret_key,
-                                      GVariant **out_public_key,
-                                      GError **error)
- {
-  g_debug ("%s enter", __FUNCTION__);
-  g_return_val_if_fail (OSTREE_IS_SIGN (self), FALSE);
-
-  OstreeSignEd25519 *sign = ostree_sign_ed25519_get_instance_private(OSTREE_SIGN_ED25519(self));
-
-  if (sign->initialized != TRUE)
-    {
-      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                          "Not able to sign -- libsodium library isn't initialized properly");
-      goto err;
-    }
-
-#ifdef HAVE_LIBSODIUM
-  unsigned char pk[crypto_sign_PUBLICKEYBYTES];
-  unsigned char sk[crypto_sign_SECRETKEYBYTES];
-
-  if (crypto_sign_keypair(pk, sk))
-    {
-      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                          "Not able to generate keypair");
-      goto err;
-    }
-
-  *out_secret_key = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, sk, crypto_sign_SECRETKEYBYTES, sizeof(guchar));
-  *out_public_key = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, pk, crypto_sign_PUBLICKEYBYTES, sizeof(guchar));
-
-  return TRUE;
-#endif /* HAVE_LIBSODIUM */
-
-err:
-  return FALSE;
-}
-
 gboolean ostree_sign_ed25519_set_sk (OstreeSign *self,
                                      GVariant *secret_key,
                                      GError **error)
@@ -392,50 +347,6 @@ _load_pk_from_stream (OstreeSign *self, GDataInputStream *key_data_in, GError **
 #ifdef HAVE_LIBSODIUM
   gboolean ret = FALSE;
 
-#if 0
-/* Try to load the public key in signify format from the stream
- * https://www.openbsd.org/papers/bsdcan-signify.html
- * 
- * FIXME: Not sure if we need to support that format.
- * */
-  g_autofree gchar * comment = NULL;
-  while (TRUE)
-    {
-      gsize len = 0;
-      g_autofree char *line = g_data_input_stream_read_line (key_data_in, &len, NULL, error);
-      if (error)
-        goto err;
-
-      if (line)
-        {
-          g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                               "Signify format for ed25519 public key not found");
-          goto err;
-        }
-      
-      if (comment == NULL)
-        {
-          /* Scan for the comment first and compare with prefix&suffix */
-          if (g_str_has_prefix (line, SIGNIFY_COMMENT_HEADER) && g_str_has_suffix (line, "public key"))
-            /* Save comment without the prefix and blank space */
-            comment = g_strdup (line + strlen(SIGNIFY_COMMENT_HEADER) + 1);
-        }
-      else
-        {
-          /* Read the key itself */
-          /* base64 encoded key */
-          gsize keylen = 0;
-          g_autofree guchar *key = g_base64_decode (line, &keylen);
-
-          /* Malformed key */
-          if (keylen != SIGNIFY_ID_LENGTH ||
-              strncmp (line, SIGNIFY_MAGIC_ED25519, strlen(SIGNIFY_MAGIC_ED25519)) != 0)
-            continue;
-
-        }
-    }
-#endif /* 0 */
-
   /* Use simple file format with just a list of base64 public keys per line */
   while (TRUE)
     {
index eb8f6701b0231d57d2d7ab783f56e8a1bd743434..16da4828f101467d67a9002b70199f835065ed5e 100644 (file)
@@ -41,19 +41,19 @@ G_DECLARE_FINAL_TYPE (OstreeSignEd25519,
 
 
 gboolean ostree_sign_ed25519_data (OstreeSign *self,
-                                 GBytes *data,
-                                 GBytes **signature,
-                                 GCancellable *cancellable,
-                                 GError **error);
+                                   GBytes *data,
+                                   GBytes **signature,
+                                   GCancellable *cancellable,
+                                   GError **error);
 
 const gchar * ostree_sign_ed25519_get_name (OstreeSign *self);
 const gchar * ostree_sign_ed25519_metadata_key (OstreeSign *self);
 const gchar * ostree_sign_ed25519_metadata_format (OstreeSign *self);
 
 gboolean ostree_sign_ed25519_metadata_verify (OstreeSign *self,
-                                            GBytes     *data,
-                                            GVariant   *signatures,
-                                            GError     **error);
+                                              GBytes     *data,
+                                              GVariant   *signatures,
+                                              GError     **error);
 
 gboolean ostree_sign_ed25519_set_sk (OstreeSign *self,
                                      GVariant *secret_key,
@@ -71,12 +71,5 @@ gboolean ostree_sign_ed25519_load_pk (OstreeSign *self,
                                       GVariant *options,
                                       GError **error);
 
-_OSTREE_PUBLIC
-gboolean ostree_sign_ed25519_keypair_generate (OstreeSign *self,
-                                               GVariant **out_secret_key,
-                                               GVariant **out_public_key,
-                                               GError **error);
-
-
 G_END_DECLS